import 'package:flutter/material.dart';
import './models/ListTileModel.dart';

class BottomSheet1 extends StatefulWidget {
  final String title;

  BottomSheet1({required String this.title});

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<BottomSheet1> {
  @override
  Widget build(BuildContext context) {
    return 
            new TextButton(
              child: Text(
                "Open Bottom Sheet",
                style: TextStyle(fontSize: 20),
              ),
              onPressed: () {
                _openBottomSheet(context);
              },
            )
    ;
    // return Scaffold(
    //   appBar: AppBar(
    //     title: Text(widget.title),
    //     backgroundColor: Colors.redAccent,
    //   ),
    //   body: Center(
    //     child: Column(
    //       mainAxisAlignment: MainAxisAlignment.center,
    //       children: <Widget>[
    //         new TextButton(
    //           child: Text(
    //             "Open Bottom Sheet",
    //             style: TextStyle(fontSize: 20),
    //           ),
    //           onPressed: () {
    //             _openBottomSheet(context);
    //           },
    //         )
    //       ],
    //     ),
    //   ),
    // );
  }
}

void _openBottomSheet(context) {

  showModalBottomSheet(
    context: context,
    builder: (builder) {
      return new Container(
        padding: EdgeInsets.all(5.0),
        child: new Wrap(
          children: <Widget>[
            getListTile(Icons.more, Colors.black45, "More", context),
            getListTile(Icons.favorite, Colors.pink, "Favourites", context),
            getListTile(Icons.account_box, Colors.blue, "Profile", context),
            new Divider(
              thickness: 2.0,
              height: 10.0,
            ),
            getListTile(Icons.exit_to_app, null, "Logout", context),
          ],
        ),
      );
    },
  );
}
